-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to use slim in conjunction with ejs and jst in sprockets 4 #148
base: master
Are you sure you want to change the base?
Conversation
lib/slim-rails/register_engine.rb
Outdated
@@ -30,6 +30,7 @@ def self._register_engine(config) | |||
config.assets.configure do |env| | |||
if env.respond_to?(:register_transformer) && Sprockets::VERSION.to_i > 3 | |||
env.register_mime_type 'text/slim', extensions: ['.slim', '.slim.html']#, charset: :html | |||
env.register_mime_type 'application/javascript', extensions: ['.js.jst.ejs.slim'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be very specific and tailored for your use case, but I think that if we're going add this, then let's do it in a more general form, how about:
env.register_mime_type 'application/javascript', extensions: %w[.js.slim .jst.slim .ejs.slim]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to do so. However I did realize that it is not working as intended. Will continue investigation and report back once solved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it more general
Could you also add test similar to the one we already have for html? asset_path = File.join(dir, 'app', 'assets', 'html', 'test.slim')
FileUtils.mkdir_p(File.dirname(asset_path))
File.write(asset_path, ".test\n | hi") of course let's add some JS instead of html |
@stiller-leser I know it's been a while, are you still interested in finishing this PR or should we rather fork this and continue on new branch? |
Hi @januszm, what a blast from the past. I have since completly changed job profiles and companies as well. So I do not even know anymore why / where this was needed. You are probably better of forking this PR. Sorry, I can't continue with this. If there is anything I can do, let me know and I will try to help out. Best regards, |
We use slim in our rails app in conjunction with ejs and jst (file ending: *.js.jst.ejs.slim). Sprockets 4 won't recognize slim files as 'application/javascript' and hence fail when used in the above combination. I am aware that this is an edge case, but it prevents us from switching to sprockets 4.